{% extends "base.html" %}
{% load get_item %}
{% block header %}系统参数配置{% endblock %}
{% block content %}
<div class="row justify-content-center">
    <div class="col-md-6">
        <form method="post">
            {% csrf_token %}
            {% for c in config %}
            <div class="mb-3">
                <label for="{{c.key}}" class="form-label">{{c.name}}</label>
                {% if c.type == 1 %}
                <input type="text" class="form-control" id="{{c.key}}" name="{{c.key}}" value="{{ c.value }}" >
                {% endif %}
                {% if c.type == 2 %}
                <textarea class="form-control" style="height: 300px;" id="{{c.key}}" name="{{c.key}}" >{{ c.value }}</textarea>
                {% endif %}
                {% if c.type == 3 %}
                <select class="form-select" id="{{c.key}}" name="{{c.key}}" >
                    {% for opt in c.options|split_by:'|' %}
                    <option value="{{ opt }}" {% if c.value == opt %}selected{% endif %}>{{ opt }}</option>
                    {% endfor %}
                </select>
                {% endif %}
            </div>
            {% endfor %}
            <button type="submit" class="btn btn-primary w-100">保存</button>
        </form>
    </div>
</div>
{% endblock %}
